pipeline {
  agent any
  stages {
    stage('Build') {
      //这里指定了agent为build，即在Jenkins中配置的build节点
      agent { label "build" }
      steps {
        echo 'Building the project'
      }
    }
  }
  post {
    always {
      script {
        println("pipeline结束后执行的操作")
      }
    }
    success {
      script {
        println("pipeline成功执行的操作")
      }
    }
    failure {
      script {
        println("pipeline失败执行的操作")
      }
    }
    aborted {
      script {
        println("pipeline被中止执行的操作")
      }
    }
  }
}
